#include "StdAfx.h"
#include "MqListener.h"

CMqListener::CMqListener()
{
}

CMqListener::~CMqListener()
{
}

void CMqListener::onMessage( const cms::Message* message )
{
	try
	{
		const cms::MapMessage* mapMsg = dynamic_cast< const cms::MapMessage* >(message);
		if (mapMsg == NULL)
		{
			return;
		}
		int nType = 0;
		int nId = 0;
		std::string sName = "";
		nType = mapMsg->getInt("Type");
		nId = mapMsg->getInt("Id");
		sName = mapMsg->getString("Name").c_str();

		printf("TYpe = %d, Id = %d, Name = %s", nType, nId, sName.c_str());
	} 
	catch (cms::CMSException& e)
	{
		e.printStackTrace();
	}	
}